package com.xnyzc.lhy.mis.controller.cmsapi.vehicle;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.param.cms.vehicle.VehicleBrandParam;
import com.xnyzc.lhy.mis.entity.result.cms.veh.VehicleTypeSeries;
import com.xnyzc.lhy.mis.service.cms.vehicle.VehicleBrandService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 车辆品牌相关
 *
 * @Author: wangshuo
 * @Date: 2019-08-23 14:11
 */
@RestController
@RequestMapping("/cmsapi/vehiclebrand")
public class VehicleBrandController {

    @Autowired
    private VehicleBrandService vehicleBrandService;

    /**
     * 获取已关联的车系
     *
     * @return
     */
    @ApiOperation(value = "获取已关联的车系", notes = "获取已关联的车系")
    @PostMapping(value = "/getAssociatedBrandList")
    public Rv getAssociatedBrandList(
            @ApiParam(name = "vehicleBrandParam", value = "接入传参") @RequestBody VehicleBrandParam vehicleBrandParam
    ) {
        return Rv.wrap(vehicleBrandService.getAssociatedBrandList(vehicleBrandParam));
    }


    /**
     * 获取车辆品牌列表
     *
     * @return
     */
    @ApiOperation(value = "获取车辆品牌列表", notes = "获取车辆品牌列表")
    @PostMapping(value = "/getVehicleBrandList")
    public Rv getVehicleBrandList(
            @ApiParam(name = "vehicleBrandParam", value = "接入传参") @RequestBody VehicleBrandParam vehicleBrandParam
    ) {
        return Rv.wrap(vehicleBrandService.getVehicleBrandList(vehicleBrandParam));
    }

    /**
     * 类型关联车系
     *
     * @return
     */
    @ApiOperation(value = "类型关联车系", notes = "类型关联车系")
    @PostMapping(value = "/getVehicleSeries")
    public Rv getVehicleSeries(
            @ApiParam(name = "vehicleBrandParam", value = "接入传参") @RequestBody VehicleBrandParam vehicleBrandParam
    ) {
        return Rv.wrap(vehicleBrandService.getVehicleSeries(vehicleBrandParam));
    }

    /**
     * 取消关联
     *
     * @return
     */
    @ApiOperation(value = "取消关联", notes = "取消关联")
    @PostMapping(value = "/getVehicleSeriesCancel")
    public Rv getVehicleSeriesCancel(
            @ApiParam(name = "vehicleBrandParam", value = "接入传参") @RequestBody VehicleBrandParam vehicleBrandParam
    ) {
        return Rv.wrap(vehicleBrandService.getVehicleSeriesCancel(vehicleBrandParam));
    }

    /**
     * 获取用车等级类型
     *
     * @return
     */
    @ApiOperation(value = "获取用车等级类型", notes = "获取用车等级类型")
    @PostMapping(value = "/getRequireLevel")
    public Rv getRequireLevel() {
        return Rv.wrap(vehicleBrandService.getRequireLevel());
    }


    /**
     * 获取所有车辆信息
     *
     * @return
     */
    @ApiOperation(value = "获取用车等级类型", notes = "获取用车等级类型")
    @PostMapping(value = "/getAllVehicle")
    public Rv getAllVehicle() {
        return Rv.wrap(vehicleBrandService.getAllVehicle());
    }

    /**
     * 更新用车等级类型
     *
     * @return
     */
    @ApiOperation(value = "更新用车等级类型", notes = "更新用车等级类型")
    @PostMapping(value = "/updateVehicleType")
    public Rv updateVehicleType( @ApiParam(name = "vehicleBrandParam", value = "接入传参") @RequestBody VehicleTypeSeries vehicleTypeSeries) {
        return Rv.wrap(vehicleBrandService.updateVehicleType(vehicleTypeSeries));
    }

    @ApiOperation(value = "导出车型", notes = "导出车型")
    @PostMapping(value = "/exportVehicleType")
    public Rv exportVehicleType() {
        return Rv.wrap(vehicleBrandService.exportVehicleType());
    }

    /**
     * 新增用车等级类型
     *
     * @return
     */
    @ApiOperation(value = "新增用车等级类型", notes = "新增用车等级类型")
    @PostMapping(value = "/addVehicleType")
    public Rv addVehicleType( @ApiParam(name = "vehicleBrandParam", value = "接入传参") @RequestBody VehicleTypeSeries vehicleTypeSeries) {
        return Rv.wrap(vehicleBrandService.addVehicleType(vehicleTypeSeries));
    }

    /**
     * 根据品牌名模糊查询品牌
     *
     * @return
     */
    @ApiOperation(value = "模糊查询品牌", notes = "模糊查询品牌")
    @PostMapping(value = "/getVehicleBrand")
    public Rv getVehicleBrand(@RequestParam("brandName") String brandName) {
       return vehicleBrandService.getVehicleBrand(brandName);
    }

    /**
     * 根据品牌号和车系名模糊查询车系列表
     * @return
     */
    @ApiOperation(value = "模糊查询车系", notes = "模糊查询车系")
    @PostMapping(value = "/getVehicleSeriesOfList")
    public Rv getVehicleSeriesOfList( @RequestParam("brandId") String brandId,
                                      @RequestParam("seriesName") String seriesName) {
       return vehicleBrandService.getVehicleSeriesOfList(brandId,seriesName);
    }
}
